﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Business.Logic;
using Business.Entities;

namespace UI.Desktop
{
    public partial class ListadoAlumnos : Form
    {
        private Persona _PersonaActual;

        public Persona PersonaActual { get {return _PersonaActual; } set { _PersonaActual = value; } }

        public ListadoAlumnos()
        {
            InitializeComponent();
        }

        public ListadoAlumnos(Persona per):this()
        {
            PersonaActual = per;
        }

        private void ListadoAlumnos_Load(object sender, EventArgs e)
        {
            this.dgvListadoAlumnos.AutoGenerateColumns = false;
            ListadoAlumnoLogic LisLog = new ListadoAlumnoLogic();
            cmbMateria.DataSource = LisLog.ListaMaterias(PersonaActual);
        }

        private void btnSalir_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnListar_Click(object sender, EventArgs e)
        {
            ListadoAlumnoLogic lisLog = new ListadoAlumnoLogic();
            string mat= cmbMateria.SelectedValue.ToString();
            dgvListadoAlumnos.DataSource = lisLog.GetAll(PersonaActual, mat);
        }
    }
}
